# lib/stair_master/workflow_map/rules/skip_rule.rb

module StairMaster
  module WorkflowMap
    module Rules
      class SkipRule < ::StairMaster::WorkflowMap::Rules::Base
        ## Describe the condition -------------------------
        def description
          "The step '#{ @step.name }' will be skipped #{ @type } #{ @method_name } returns TRUE"
        end

        ## Actually attempt to test this condition.
        ## The context is that of the current controller
        ##
        def pass?(context)
          if @type == :if
            return context.send(@method_name)
          else
            return !context.send(@method_name)
          end
        end
      end
    end
  end
end
